<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>商品编辑</title>
    <link th:href="@{/local/css/goodsAdd.css}" rel="stylesheet">
</head>
<body>
<div>
    <div id="top" th:include="head.html"></div>
    <div id="middle">
        <div id="left" th:include="left.html::left"></div>
        <div id="right">
            <div id="msg" th:text="${msg}"></div>
            <form id="editGoods" action="/admin/goods/editGoods" method="post">
                <input type="hidden" name="id" th:value="${goods.getId()}">
                <table id="addTable">
                    <tr><th>名称</th><td><input type="text" name="name" th:value="${goods.getName()}"></td></tr>
                    <tr><th>编号</th><td><input type="text" name="code" th:value="${goods.getCode()}"></td></tr>
                    <tr><th>类别</th>
                        <td>
                            <select name="categoryId">
                                <option th:each="category:${categoryList}"
                                        th:value="${category.getId()}"
                                        th:text="${category.getName()}"
                                        th:selected="${goods.getCategoryId()} eq ${category.getId()}">
                                </option>
                            </select>
                        </td>
                    </tr>
                    <tr><th>单价</th><td><input type="number"  name="price" th:value="${goods.getPrice()}"></td></tr>
                    <tr><th>库存</th><td><input type="number"  name="quantity" th:value="${goods.getQuantity()}"></td></tr>
                    <tr><th>是否热销</th>
                        <td>
                            <input type="radio" name="hot" th:attr="checked = ${goods.getHot() == 1}" value="1">是
                            <input type="radio" name="hot" th:attr="checked = ${goods.getHot() == 0}" value="0">否
                        </td>
                    </tr>
                    <tr>
                        <th>商品图片</th>
                        <td>
                            <div class="upload">
                                <span class="plus">+</span>
                                <input type="file"  id="input" accept=".jpg, .jpeg, .png">
                                <input id="gdimage" type="hidden" name="image" th:value="${goods.getImage()}"  >
                            </div>
                            <img type="image" id="img" th:src="${goods.getImage()}" alt="#">
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <input id ="btngoBack" type="button" value="返回">
                            <input type="reset" value="重置">
                            <input type="submit" value="提交">
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
    <div id="bottom" th:include="bottom.html::bottom"></div>
    <script th:src="@{/js/axios.min.js}"></script>
    <script th:src="@{/local/js/imageAdd.js}"></script>
</div>

</body>
</html>